## 9.5. CGI and Databases

From the beginning of Internet time, databases have interacted with the development of the World Wide Web. In fact, many view the web as simply an enormous database of multimedia information.

Search engines are an everyday example of the benefits of databases. An engine does not go all over the web looking for keywords the moment you ask for them; instead the site's developers use other programs to create an enormous index that serves as a database from which the engine retrieves entries. Databases store information in a manner that allows quick, random-access retrieval.

Because databases are mutable, they lend even more power to the web: they turn it into a potential user interface for anything. System administration, for instance, could be performed remotely over a web interface instead of requiring the administrator to log into the affected system. Connecting databases to the web is the key to a new world of interactivity on the Internet.

> #### NOTE

> One reason for connecting databases to the web pops up repeatedly: much of the world's information is already in databases. Databases that existed before the creation of the web are referred to as legacy databases (as opposed to nonweb connected databases that were created recently, which are referred to as a bad idea). Many corporations (and even individuals) are now faced with the task of making these legacy databases available over the web. Unless your legacy database is in MySQL or mSQL, this topic is beyond the scope of this book.1

As mentioned earlier, only your imagination limits the uses of database-web connectivity. Thousands of unique, useful databases currently exist that are available over the web for some reason or another. The types of database that are behind the scenes of these applications vary widely. Some of them use CGI programs to interface with a database server such as MySQL or mSQL. These are the types that we are most interested in. Others use commercial applications to interact with popular desktop databases, such as Microsoft Access and Claris FileMaker Pro. Still others simply deal with plain text files, which are the simplest databases of all.

Using these three types of databases, useful web sites of all sizes and levels of sophistication can be developed. One of our focuses over the next few chapters will be to apply the power of MySQL and mSQL to the web through CGI programming.

Copyright © 2001 O'Reilly & Associates. All rights reserved.